package ar.com.fiuba.ElectronicCircuitAnalyst.domain.api.repository;

import java.util.Collection;

import ar.com.fiuba.ElectronicCircuitAnalyst.domain.exceptions.DuplicateElementException;
import ar.com.fiuba.ElectronicCircuitAnalyst.domain.exceptions.ElementNotFoundException;

public interface Repository<T> {

	public Collection<T> findAll();
	
	/**
	 * Updat the given bean.
	 * 
	 * @param t
	 *            the bean to persist.
	 */
	public T update(T t);

	/**
	 * Persist the given bean.
	 * 
	 * @param t
	 *            the bean to persist.
	 */
	public T save(T t) throws DuplicateElementException;

	
	/**
	 * Get all instances that match the properties that are set in the given
	 * object using a standard Query by Example method.
	 * 
	 * @param t
	 *            the example bean
	 * 
	 * @return a list of beans that match the example.
	 */
	public Collection<T> get(T t);

	
	/**
	 * Remove the bean passed. same as remove(t.<idProoertyGetter>())
	 * 
	 * @param t
	 *            the object to remove.
	 */
	void remove(T t) throws ElementNotFoundException;;

}
